if exists (select name from sysobjects where name like 'Proc_ChucVu_GetALL')
	drop procedure Proc_ChucVu_GetALL
go

create PROC Proc_ChucVu_GetALL (@type int)
as
if(@type =1)--- dirty read
begin
	begin tran
	set tran isolation level read uncommitted
	select * from ChucVu where DelFlg=0
	commit tran
end
else
begin
	begin tran
	set transaction isolation level repeatable read
	select * from ChucVu where DelFlg=0
	waitfor delay '00:00:10'
	select * from ChucVu where DelFlg=0
commit tran
end
go

Exec Proc_ChucVu_GetALL 2
go


select * from ChucVu

----------------------------------
if exists (select name from sysobjects where name like 'Proc_ChucVu_GetById')
	drop procedure Proc_ChucVu_GetById
go

create PROC Proc_ChucVu_GetById (@maChucVu int)
as
	select * from ChucVu
	where MaChucVu = @maChucVu

go

Exec Proc_ChucVu_GetById 1
go
------------------------


select * from ChucVu

--------------------
if exists (select name from sysobjects where name like 'Proc_ChucVu_GetDelFlg')
	drop procedure Proc_ChucVu_GetDelFlg
go

create PROC Proc_ChucVu_GetDelFlg
as
	select DelFlg from ChucVu
	group by DelFlg
go

Exec Proc_ChucVu_GetDelFlg
go
